"use strict"

const Controller = require("egg").Service;

class BillsController extends Controller {
    // 账单
    async list(id) {
        const { ctx, app } = this
        const QUERY_STR = "id, pay_type, amount, data, type_id, type_name, remark"
        let sql = `select ${QUERY_STR} from bill where user_id=${id}`
        try {
            const result = await app.mysql.query(sql)
            return result
        } catch (error) {
            console.log(error);
            return null
        }
    }
}

module.exports = BillsController